// JavaScript Document

	var pic_current=1;
	var pic_num=0;
	var auto_qiehuan;
	var pic_ul_li_num=1;
	var pic_ul_li_click=1;
	$(document).ready(function(e) {

		pic_num=$("#focus_pic a").length;
		
		for(pic_ul_li_num;pic_ul_li_num<=pic_num;pic_ul_li_num++){
			if(pic_ul_li_num==1){
				$("<li><img id='pic_ul_li_img"+pic_ul_li_num+ "' src='images/pic_ul_li_big.png'></li>").appendTo("#pic_ul ul");
			}
			else{
				$("<li><img id='pic_ul_li_img"+pic_ul_li_num+ "' src='images/pic_ul_li_small.png'></li>").appendTo("#pic_ul ul");
			}
			
		}
		
		
		$("#pic_next").mouseup(function(){
			auto_qiehuan = setTimeout("qiehuan()",5000);
			});
        $("#pic_next").click(function(){
			//$("#display").html(pic_num);
			clearTimeout(auto_qiehuan);
    		$("#focus_"+pic_current).stop(true,false).animate({left:'-560px'},"normal");
			$("#title_"+pic_current).stop(true,false).animate({left:'-580px'},"normal");
			$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
			pic_current++;
			if(pic_current>pic_num){
				pic_current=1;
			}
			$("#focus_"+pic_current).css({"left":560,"display":"block","top":-300*(pic_current-1)});
			$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
			$("#title_"+pic_current).css({"left":580,"display":"block","top":-40*(pic_current-1)});
			$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
			$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
		});
		
		$("#pic_before").mouseup(function(){
			auto_qiehuan = setTimeout("qiehuan()",5000);
			});
		$("#pic_before").click(function(){
			//$("#display").html(pic_num);	
			clearTimeout(auto_qiehuan);	
    		$("#focus_"+pic_current).stop(true,false).animate({left:'560px'},"normal");	
			$("#title_"+pic_current).stop(true,false).animate({left:'580px'},"normal");	
			$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
			pic_current--;
			if(pic_current<1){
				pic_current=pic_num;
			}
			$("#focus_"+pic_current).css({"left":-560,"display":"block","top":-300*(pic_current-1)});
			$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
			$("#title_"+pic_current).css({"left":-580,"display":"block","top":-40*(pic_current-1)});
			$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
			$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
		});
		
		
		//$("#pic_ul_li_img1").click(function(){
			//$("#display").html("ceshi");
			//});
		$("#pic_ul_li_img"+1).click(function(){
			clearTimeout(auto_qiehuan);	
			$("#focus_"+pic_current).stop(true,false).animate({left:'560px'},"normal");
			$("#title_"+pic_current).stop(true,false).animate({left:'580px'},"normal");
			$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
			pic_current=1;
				
			$("#focus_"+pic_current).css({"left":-560,"display":"block","top":-300*(pic_current-1)});
			$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
			$("#title_"+pic_current).css({"left":-580,"display":"block","top":-40*(pic_current-1)});
			$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
			$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			});
		$("#pic_ul_li_img"+1).mouseup(function(){
			auto_qiehuan = setTimeout("qiehuan()",5000);
			});
			
		$("#pic_ul_li_img"+2).click(function(){
			clearTimeout(auto_qiehuan);	
			if(2>pic_current){
				
				$("#focus_"+pic_current).stop(true,false).animate({left:'-560px'},"normal");
				$("#title_"+pic_current).stop(true,false).animate({left:'-580px'},"normal");
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
				pic_current=2;
				
				$("#focus_"+pic_current).css({"left":560,"display":"block","top":-300*(pic_current-1)});
				$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#title_"+pic_current).css({"left":580,"display":"block","top":-40*(pic_current-1)});
				$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			}
			else{
				$("#focus_"+pic_current).stop(true,false).animate({left:'560px'},"normal");
				$("#title_"+pic_current).stop(true,false).animate({left:'580px'},"normal");
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
				pic_current=2;
				
				$("#focus_"+pic_current).css({"left":-560,"display":"block","top":-300*(pic_current-1)});
				$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#title_"+pic_current).css({"left":-580,"display":"block","top":-40*(pic_current-1)});
				$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			}
			
			});
		$("#pic_ul_li_img"+2).mouseup(function(){
			auto_qiehuan = setTimeout("qiehuan()",5000);
			});
		
		$("#pic_ul_li_img"+3).click(function(){
			clearTimeout(auto_qiehuan);	
			if(3>pic_current){
				
				$("#focus_"+pic_current).stop(true,false).animate({left:'-560px'},"normal");
				$("#title_"+pic_current).stop(true,false).animate({left:'-580px'},"normal");
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
				pic_current=3;
				
				$("#focus_"+pic_current).css({"left":560,"display":"block","top":-300*(pic_current-1)});
				$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#title_"+pic_current).css({"left":580,"display":"block","top":-40*(pic_current-1)});
				$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			}
			else{
				$("#focus_"+pic_current).stop(true,false).animate({left:'560px'},"normal");
				$("#title_"+pic_current).stop(true,false).animate({left:'580px'},"normal");
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
				pic_current=3;
				
				$("#focus_"+pic_current).css({"left":-560,"display":"block","top":-300*(pic_current-1)});
				$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#title_"+pic_current).css({"left":-580,"display":"block","top":-40*(pic_current-1)});
				$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			}
			});
		$("#pic_ul_li_img"+3).mouseup(function(){
			auto_qiehuan = setTimeout("qiehuan()",5000);
			});
		
		$("#pic_ul_li_img"+4).click(function(){
			clearTimeout(auto_qiehuan);
			if(4>pic_current){
				
				$("#focus_"+pic_current).stop(true,false).animate({left:'-560px'},"normal");
				$("#title_"+pic_current).stop(true,false).animate({left:'-580px'},"normal");
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
				pic_current=4;
				
				$("#focus_"+pic_current).css({"left":560,"display":"block","top":-300*(pic_current-1)});
				$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#title_"+pic_current).css({"left":580,"display":"block","top":-40*(pic_current-1)});
				$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			}
			else{
				$("#focus_"+pic_current).stop(true,false).animate({left:'560px'},"normal");
				$("#title_"+pic_current).stop(true,false).animate({left:'580px'},"normal");
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
				pic_current=4;
				
				$("#focus_"+pic_current).css({"left":-560,"display":"block","top":-300*(pic_current-1)});
				$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#title_"+pic_current).css({"left":-580,"display":"block","top":-40*(pic_current-1)});
				$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			}	
			});
		$("#pic_ul_li_img"+4).mouseup(function(){
			auto_qiehuan = setTimeout("qiehuan()",5000);
			});
		
		$("#pic_ul_li_img"+5).click(function(){
			clearTimeout(auto_qiehuan);	
			if(5>pic_current){
				
				$("#focus_"+pic_current).stop(true,false).animate({left:'-560px'},"normal");
				$("#title_"+pic_current).stop(true,false).animate({left:'-580px'},"normal");
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
				pic_current=5;
				
				$("#focus_"+pic_current).css({"left":560,"display":"block","top":-300*(pic_current-1)});
				$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#title_"+pic_current).css({"left":580,"display":"block","top":-40*(pic_current-1)});
				$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			}
			else{
				$("#focus_"+pic_current).stop(true,false).animate({left:'560px'},"normal");
				$("#title_"+pic_current).stop(true,false).animate({left:'580px'},"normal");
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
				pic_current=5;
				
				$("#focus_"+pic_current).css({"left":-560,"display":"block","top":-300*(pic_current-1)});
				$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#title_"+pic_current).css({"left":-580,"display":"block","top":-40*(pic_current-1)});
				$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
				$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			}
			});
		$("#pic_ul_li_img"+5).mouseup(function(){
			auto_qiehuan = setTimeout("qiehuan()",5000);
			});
		
		$("#pic_ul_li_img"+6).click(function(){
			clearTimeout(auto_qiehuan);	
			$("#focus_"+pic_current).stop(true,false).animate({left:'-560px'},"normal");
			$("#title_"+pic_current).stop(true,false).animate({left:'-580px'},"normal");
			$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");
			pic_current=1;
				
			$("#focus_"+pic_current).css({"left":560,"display":"block","top":-300*(pic_current-1)});
			$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
			$("#title_"+pic_current).css({"left":580,"display":"block","top":-40*(pic_current-1)});
			$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
			$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
			});
		$("#pic_ul_li_img"+6).mouseup(function(){
			auto_qiehuan = setTimeout("qiehuan()",5000);
			});
			
		auto_qiehuan = setTimeout("qiehuan()",5000);
		
		
    });
function qiehuan(){
	$("#focus_"+pic_current).stop(true,false).animate({left:'-560px'},"normal");
	$("#title_"+pic_current).stop(true,false).animate({left:'-580px'},"normal");
	$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_small.png");		
	pic_current++;
	if(pic_current>pic_num){
		pic_current=1;
	}
	$("#focus_"+pic_current).css({"left":560,"display":"block","top":-300*(pic_current-1)});
	$("#focus_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
	$("#title_"+pic_current).css({"left":580,"display":"block","top":-40*(pic_current-1)});
	$("#title_"+pic_current).stop(true,false).animate({left:'0px'},"normal");	
	$("#pic_ul_li_img"+pic_current).attr("src","images/pic_ul_li_big.png");
	
	auto_qiehuan = setTimeout("qiehuan()",5000);
}
